
-- enabling the debug system:
dofilepath("bin:DebugTweaks.lua")

bind3( "Sound_Reload()", CONTROLKEY, ALTKEY, RKEY )-- Reload the sound Data
bind3( "Sound_ToggleMusic()", CONTROLKEY, ALTKEY, MKEY ) -- turn music on/off
bind3( "Sound_ToggleSpeech()", CONTROLKEY, ALTKEY, SKEY ) -- turn speech on/off


dofilepath("bin:localexec.lua")

bind3("dofilepath(\"bin:aidebug.lua\")", CONTROLKEY, SHIFTKEY, AKEY ) -- turn ai debug on

--
-- CTRL-ALT-K: toggle display of [KAS] watches
-- ??? can we move this sort of code back into the DataHW1Campaign dir with a doFilePath() call?
--
bSinglePlayerStatMon = 0
function singlePlayerRulesProfileToggle()
    print("IKEY: RulesProfile, LKEY: StatMon, JKEY: DebugInfo")
    if (bSinglePlayerRulesProfile == 0) then
        bSinglePlayerRulesProfile = 1
    else
        bSinglePlayerRulesProfile = 0
    end
    rulesProfiler(bSinglePlayerRulesProfile)
end

--
-- CTRL-ALT-L: toggle display of Lua state
--
bSinglePlayerStatMon = 0
function singlePlayerStatMonToggle()
    print("IKEY: RulesProfile, LKEY: StatMon, JKEY: DebugInfo")
    if (bSinglePlayerStatMon == 0) then
        bSinglePlayerStatMon = 1
    else
        bSinglePlayerStatMon = 0
    end
    LCWatcher_Activate(bSinglePlayerStatMon)
    LCWatcher_AddFilter(LC_Scar, "G_")
--    LCWatcher_AddFilter(LC_Scar, "ImNotHere_;Damaged;_VIFONCE")
    LCWatcher_AddFilter(LC_Scar, "Locals")
    LCWatcher_AddFilter(LC_Scar, "sp")
    --StatMonProfiling(bSinglePlayerStatMon)
end

--
-- CTRL-ALT-J: toggle display of verbose in-game debug info
--
bSinglePlayerDebugInfo = 0
function singlePlayerDebugInfoToggle()
    print("IKEY: RulesProfile, LKEY: StatMon, JKEY: DebugInfo")
    if (bSinglePlayerDebugInfo == 0) then
        bSinglePlayerDebugInfo = 1
    else
        bSinglePlayerDebugInfo = 0
    end
    ShowShipDebug(bSinglePlayerDebugInfo)
    ShowAIPaths(bSinglePlayerDebugInfo)
    ShowLevelVolumes(bSinglePlayerDebugInfo)
    ShowDebugInfo(bSinglePlayerDebugInfo)
	ShowDebugVectors(bSinglePlayerDebugInfo)
    --ShowInfo(bSinglePlayerDebugInfo)
end

--
-- Enable NIS debug features
--
nisDebugInfo = 0
function singlePlayerShowInfoToggle()
    print("IKEY: ShowInfoToggle, OKEY: CameraRelease, PKEY: PauseToggle, RKEY: Rewind, EKEY: RewindLots, TKEY: JumpForward, YKEY: JumpForwardLots")
    if (nisDebugInfo ~= 0) then
        nisDebugInfo = 0
    else
        nisDebugInfo = 1
    end
    NISDebug_Enable3D(NISDebug_V3D_Leaders, nisDebugInfo)
    NISDebug_Enable3D(NISDebug_V3D_Paths, nisDebugInfo)
    NISDebug_ShowInfo()

end
function singlePlayerCameraReleaseToggle()
    print("IKEY: singlePlayerCameraRelease")
    NISDebug_CameraRelease()
    Camera_AllowControl(1)
    Universe_AllowPlayerOrders(1)
    Sensors_EnableToggle(1)
end
function singlePlayerPauseToggle()
    print("singlePlayerPauseToggle")
    NISDebug_PauseToggle()
end
function singlePlayerRewind()
    print("singlePlayerRewind")
    NISDebug_Rewind()
end
function singlePlayerRewindLots()
    print("singlePlayerRewindLots")
    NISDebug_RewindLots()
end
function singlePlayerJumpForward()
    print("singlePlayerJumpForward")
    NISDebug_JumpForward()
end
function singlePlayerJumpForwardLots()
    print("singlePlayerJumpForwardLots")
    NISDebug_JumpForwardLots()
end
function singlePlayerVectorUziModeInc()
    NISDebug_VectorUziModeInc()
end
function singlePlayerVectorUziModeDec()
    NISDebug_VectorUziModeDec()
end
function singlePlayerMatrixUziModeInc()
    NISDebug_MatrixUziModeInc()
end
function singlePlayerMatrixUziModeDec()
    NISDebug_MatrixUziModeDec()
end
function singlePlayerMatrixRotateModeInc()
    NISDebug_MatrixRotateModeInc()
end
function singlePlayerMatrixRotateModeDec()
    NISDebug_MatrixRotateModeDec()
end
function do360ScreenShot()
    ssUI(0)            -- Disable UI when screenshot is rendered
--  ssTGA()            -- Save screenshots as uncompressed TGA's
    ssNoSteam(1)       -- Turn off queuing screenshot for upload to Steam
--  ssSetPosterRes(2)  -- Double resolution for screenshots that are taken
    Create360Screenshots()
end
function doLargeScreenShot()
    ssUI(0)            -- Disable UI when screenshot is rendered
--  ssTGA()            -- Save screenshots as uncompressed TGA's
    ssNoSteam(1)       -- Turn off queuing screenshot for upload to Steam
    ssSetPosterRes(2)  -- Double resolution for screenshots that are taken
    screenshot()
end

--
-- Midnight uzi
--
--bind3("singlePlayerVectorUziModeInc()"     , CONTROLKEY, SHIFTKEY, DKEY)
--bind3("singlePlayerVectorUziModeDec()"     , CONTROLKEY, SHIFTKEY, FKEY)
--bind3("singlePlayerMatrixUziModeInc()"     , CONTROLKEY, SHIFTKEY, GKEY)
--bind3("singlePlayerMatrixUziModeDec()"     , CONTROLKEY, SHIFTKEY, HKEY)
--bind3("singlePlayerMatrixRotateModeInc()"  , CONTROLKEY, SHIFTKEY, JKEY)
--bind3("singlePlayerMatrixRotateModeDec()"  , CONTROLKEY, SHIFTKEY, KKEY)

--
-- Enables various debug overlays
--
bind3("singlePlayerRulesProfileToggle()", CONTROLKEY, SHIFTKEY, KKEY) -- toggle display of [KAS] states
bind3("singlePlayerStatMonToggle()", CONTROLKEY, SHIFTKEY, LKEY) -- toggle display of [KAS] variables
bind3("singlePlayerDebugInfoToggle()", CONTROLKEY, SHIFTKEY, JKEY) -- toggle display of various debug infos

--
-- Enables a buncha debug keys for useful features.
-- ???Will these automagically be disabled in release build?
--
bind3("singlePlayerShowInfoToggle()"     , CONTROLKEY, SHIFTKEY, IKEY)
bind3("singlePlayerCameraReleaseToggle()", CONTROLKEY, SHIFTKEY, OKEY)
bind3("singlePlayerPauseToggle()"        , CONTROLKEY, SHIFTKEY, PKEY)
bind3("singlePlayerRewind()"             , CONTROLKEY, SHIFTKEY, RKEY)
bind3("singlePlayerRewindLots()"         , CONTROLKEY, SHIFTKEY, EKEY)
bind3("singlePlayerJumpForward()"        , CONTROLKEY, SHIFTKEY, TKEY)
bind3("singlePlayerJumpForwardLots()"    , CONTROLKEY, SHIFTKEY, YKEY)

--
-- GBX:pdeupree - Hotkeys for god mode and destroy all enemies
--
bind3("ToggleGodMode()"                  , CONTROLKEY, SHIFTKEY, GKEY)
bind3("DestroySelectedAI()"              , CONTROLKEY, SHIFTKEY, DKEY)
bind3("ToggleLeakDetection()"            , CONTROLKEY, SHIFTKEY, VKEY)
bind3("OutputCameraInformation()"        , CONTROLKEY, SHIFTKEY, CKEY)
bind3("do360ScreenShot()"                , CONTROLKEY, SHIFTKEY, THREEKEY)
bind3("ToggleNoCursorOnOutside()"        , CONTROLKEY, SHIFTKEY, NKEY)
bind3("doLargeScreenShot()"              , CONTROLKEY, SHIFTKEY, SCROLLKEY)

--
-- Enable incremental profile dumps for diagnosing time-variant CPU loads.
--
bind3("IncrementalProfileDump(\"ProfileIncremental%02d.xml\")", CONTROLKEY, SHIFTKEY, PLUSKEY)
